package com.wyp168.renrenfilm.core.controller;

import com.wyp168.common.utils.R;
import com.wyp168.renrenfilm.core.service.FilmLabelService;
import com.wyp168.renrenfilm.core.service.FilmService;
import com.wyp168.renrenfilm.core.vo.resp.FilmCountVO;
import com.wyp168.renrenfilm.core.vo.resp.FilmCountVO1;
import com.wyp168.renrenfilm.core.vo.resp.LabelCountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("film/count")
public class CountDataController {

    @Autowired
    FilmService filmService;

    @Autowired
    FilmLabelService labelService;

    @GetMapping("countFilmData")
    public R countFilmData() {

        List<FilmCountVO> result = filmService.countData();

        return R.ok().put("data", result);
    }


    @GetMapping("countLabelData")
    public R countLabelData() {
        List<LabelCountVO> result = labelService.countData();
        return R.ok().put("data", result);
    }

    @GetMapping("countData")
    public R countData() {
        List<FilmCountVO1> result = filmService.countData1();
        return R.ok().put("data", result);
    }
}
